#!/usr/bin/env python

# Importing the controllers that will handle
# the generation of the pages:
from controllers import adminh, ajaxh, bulkh

# Importing some of Google's AppEngine modules:
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util

# This is the main method that maps the URLs
# of your application with controller classes.
# If a URL is requested that is not listed here,
# a 404 error is displayed.

def main():
    application = webapp.WSGIApplication([
        ('/admin/upload', adminh.UploadHandler),
        ('/admin/delete', adminh.DeleteHandler),
        ('/admin/test', ajaxh.LibraryTestHandler),
        ('/admin/save', ajaxh.LibrarySaveHandler),
        ('/admin/normalize', ajaxh.LibraryNormalizeHandler),
        ('/admin/putall', bulkh.PutHandler),
        ('/admin/delete/(.*)', ajaxh.LibraryDeleteHandler),
        ('/admin/validate/(.*)', ajaxh.LibraryValidateHandler),
        ('/admin/settings', adminh.SettingsHandler),
        ('/admin', adminh.ListHandler),
#        ('/admin', adminh.MainHandler),
    ],debug=True)
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()
